package com.mystudy.leetcode.contest.p_5139;

/**
 * @author 周志龙
 * @Email 15216876513@163.com
 * @Date on 2019/7/28 13:11
 * @Description 第 N 个泰波那契数
 */
public class Solution {
    public int tribonacci(int n) {
        int [] arr = new int[37];
        arr[0] = 0;
        arr[1] = 1;
        arr[2] = 1;
        for (int i = 3; i <= n; i++) {
            arr[i] = arr[i - 3]+ arr[i -2]+ arr[i-1];
        }
        return arr[n];
    }
}
